package com.mod.data {
    import com.calefk.core.Data;
	
    public class Strings extends Data {
        
        public var messages:Array;
        public var contentTexts:Array;
        
        public function Strings() {}
        
        override public function initialize(data:*):void {
            var xml:XML = new XML(data);
            
            messages = new Array();
            // read messages
            var messages_xml:XMLList = xml.messages;
            var id:String, value:String;
            for each(var message:XML in messages_xml.elements()) {
                id = message.attribute("id");
                value = message.attribute("value");
                // guardando en un arreglo los mensajes
                messages["m" + id] = value;
            }
            
            // read texts
            contentTexts = new Array();
            var contents_xml:* = xml.contentTexts.elements();
            for each (var content_xml:XML in contents_xml) {
                id = content_xml.attribute("id");
                var content_value:String = content_xml.child(0);
                contentTexts[id] = content_value;
            }
            
        }
        
        public function getMessage(id:String):String {
            return String(messages["m" + id]);
        }
    }
}